#include "Diamond.h"
#include "Map.h"

Diamond::Diamond()
	: mPosition(0.0f, 0.0f)
	, mCollected(false)
{
}

//----------------------------------------------------------------------------------------------------

Diamond::~Diamond()
{
	// Empty
}

//----------------------------------------------------------------------------------------------------

void Diamond::Load(const char* filename)
{
	mSprite.Load(filename);
	//mSprite.Add("Diamond.png");
	//mSprite.Add("Diamond2.png");
	//mSprite.Add("Diamond3.png");
	//mSprite.Play(2.0f, true);
}

//----------------------------------------------------------------------------------------------------

void Diamond::Unload()
{
	mSprite.Unload();
}

//----------------------------------------------------------------------------------------------------

void Diamond::Update(float deltaTime, const Map& map)
{
	mSprite.Update(deltaTime);											 //
	//CheckCollision(deltaTime, map);
}

//----------------------------------------------------------------------------------------------------

void Diamond::Render(const SVector2& offset)
{
	if(!mCollected)
	{
		int width = mSprite.GetWidth();
		int height = mSprite.GetHeight();

		SVector2 renderPosition(mPosition.x - (width * 0.7f), mPosition.y - (height * 0.7f));
		mSprite.SetPosition(renderPosition + offset);
		mSprite.Render();
	}
}
//----------------------------------------------------------------------------------------------------
void Diamond::Kill()
{
	mCollected = true;
}

//----------------------------------------------------------------------------------------------------
//void  Diamond::Enter()													 
//{																		 
//	mSprite.Play(4.0f, true);											 
//}																		 